import 'package:black_movice/models/BaseModel.dart';
import 'package:black_movice/models/MoviceListModel.dart';
import 'package:json_annotation/json_annotation.dart';

part 'MoviceHistoryModel.g.dart';

// 电影观看历史模型
@JsonSerializable()
class MoviceHistoryModel extends MoviceListModel {
  @JsonKey(name: 'pauseTime')
  late Duration? pauseTime; //暂停时间
  MoviceHistoryModel();
  factory MoviceHistoryModel.fromJson(Map<String, dynamic> json) =>
      _$MoviceHistoryModelFromJson(json);

  @override
  Map<String, dynamic> toJson() => _$MoviceHistoryModelToJson(this);
  // 从 JSON 数组创建 MoviceHistoryModel 列表
  static List<MoviceHistoryModel> fromJsonList(List<dynamic> jsonList) {
    return jsonList.map((json) => MoviceHistoryModel.fromJson(json)).toList();
  }
}
